package main

import "fmt"
//import "unicode/utf8"

type color_class struct {
	color_red int
	color_green int
	color_blue int
}

//定义一个结构体
type filament_hub struct {
	hub_num int
	hub_name string
	rack_num int
	rack_name string
	color_class  //结构体匿名字段
}

func main()  {
	//声明一个结构体变量
	var filament_hub1 filament_hub
	//结构体成员的初始化
	filament_hub1.hub_num = 1
	filament_hub1.hub_name = "hub1"
	filament_hub1.rack_num = 2
	filament_hub1.rack_name = "rack1"
	fmt.Printf("%d\n", filament_hub1.hub_num)
	fmt.Println(filament_hub1.hub_name)
	fmt.Printf("%d\n", filament_hub1.rack_num)
	fmt.Println(filament_hub1.rack_name)

	filament_hub1.color_class.color_red = 255
	filament_hub1.color_class.color_green = 0
	filament_hub1.color_class.color_blue = 0
	fmt.Printf("%d\n", filament_hub1.color_class.color_red)
	fmt.Printf("%d\n", filament_hub1.color_class.color_blue)
	fmt.Printf("%d\n", filament_hub1.color_class.color_green)
}
